﻿@model CP_SchoolForChildren_v0._1.Models.RelatedModel.DetailOfSchool
@using CP_SchoolForChildren_v0._1.Models.DataModel;

@{
    
    var listservice = ViewBag.listservice;
    List<Service> viewService = ViewBag.listservice;
    var comment = ViewBag.comment;
    List<CP_SchoolForChildren_v0._1.Models.RelatedModel.CommentDetail> viewComment = ViewBag.comment;
    var socialrate = ViewBag.socialrate;
    List<SocialRating> checkRate = ViewBag.socialrate;
    var star = ViewBag.star;
    var systemRate = ViewBag.systemRate;
    var getSchoolID = ViewBag.getSchoolID;
    var correctAdmission = ViewBag.correctAdmission;
}

@{
    ViewBag.Title = "Chi Tiết Trường Học";
    Layout = "~/Views/Shared/FE/_Layout_FE_Index.cshtml";
    SFCEntities db = new SFCEntities();
}
<link href="@Url.Content("~/Content/FE/Addition.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/FE/style/SchoolStyle2.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/FE/jquery.jeditable.js")" type="text/javascript"></script>
<script type="text/javascript"
    src="http://maps.googleapis.com/maps/api/js?v=3.9&sensor=true">
</script>
<script type="text/javascript">
    var map;
    var directionsDisplay;
    var directionsService = new google.maps.DirectionsService();
    function initialize() {
        var myGoogleAPI = document.getElementById('GoogleAPI').value;
        var mySplit = myGoogleAPI.split(",", 2);

        directionsDisplay = new google.maps.DirectionsRenderer();
        var schoolPlace = new google.maps.LatLng(mySplit[0], mySplit[1]);
        var mapOptions = {
            zoom: 15,
            disableDefaultUI: true,
            disableDoubleClickZoom: true,
            scrollwheel: false,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            center: schoolPlace
        }
        map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
        directionsDisplay.setMap(map);

        var image = '@Url.Content("~/Content/FE/images/beachflag.png")';
        var myLatLng = new google.maps.LatLng(mySplit[0], mySplit[1]);
        var beachMarker = new google.maps.Marker({
            position: myLatLng,
            map: map,
            icon: image
        });
    }
</script>
<script type="text/javascript">
    function checkContent() {
        var getContent = document.forms["commentForm"]["Comment_Content"].value;
        var checkEnter = getContent.indexOf("\n\n\n");
        var checkSpace = getContent.indexOf("      ");
        if (getContent == "" || getContent == null || checkEnter != -1 || checkSpace != -1) {
            alert("Bạn chưa nhập nội dung. Xin hãy thử lại!");
            return false;
        }
        if (getContent.length >= 1001) {
            alert("Hệ thống chỉ cho phép bạn nhập tối đa 1000 kí tự. Xin hãy thử lại!");
            return false;
        }
        return true;
    }
</script>
<script type="text/javascript">
    $('#submit_btn2').live('click', function () {
        if ($(this).attr("lang") != "") {
            var $ID_again = $(this).attr("name");
            var $dataString = 'schoolID=' + $ID_again;
            $.ajax({
                url: $(this).attr("data-url"),
                type: 'GET',
                data: $dataString,
                success: function (data1) {
                    alert(data1);
                }
            });
            return true;
        } else {
            alert("Bạn cần đăng nhập để thêm trường này vào danh sách ưa thích.");
            return false;
        }
        return true;
    });
</script>
<script type="text/javascript">
    $('#submit_btn1').live('click', function () {
        if ($(this).attr("lang") != "") {
            var $get100 = $(this).attr("accesskey");
            if ($get100 == 0) {
                var $report_cnt;
                $report_cnt = prompt("Xin hãy cho chúng tôi biết lí do: ");
                if ($report_cnt == "" || $report_cnt == null) {
                    alert("Bạn chưa nhập nội dung. Xin hãy thử lại!");
                    return false;
                } else {
                    var $ID_again = $(this).attr("name");
                    var $dataString = 'schoolID=' + $ID_again + '&report_cnt=' + $report_cnt;
                    $.ajax({
                        url: $(this).attr("data-url"),
                        type: 'POST',
                        data: $dataString,
                        success: function (data2) {
                            document.getElementById('submit_btn1').setAttribute('accesskey', 1);
                            alert(data2);
                        }
                    });
                    return true;
                }
                return true;
            } else {
                alert("Bạn đã báo cáo vi phạm cho trường này.");
                return false;
            }
            return true;
        } else {
            alert("Bạn cần đăng nhập để báo cáo vi phạm trường này.");
            return false;
        }
        return true;
    });
</script>
<script type="text/javascript">
    function MouseOver(option1) {
        document.getElementById('lblRate').innerText = "";
        if (option1 == 1) {
            document.getElementById('Rating1').className = "Filled";
            document.getElementById('Rating2').className = "Empty";
            document.getElementById('Rating3').className = "Empty";
            document.getElementById('Rating4').className = "Empty";
            document.getElementById('Rating5').className = "Empty";
        }
        if (option1 == 2) {
            document.getElementById('Rating1').className = "Filled";
            document.getElementById('Rating2').className = "Filled";
            document.getElementById('Rating3').className = "Empty";
            document.getElementById('Rating4').className = "Empty";
            document.getElementById('Rating5').className = "Empty";
        }
        if (option1 == 3) {
            document.getElementById('Rating1').className = "Filled";
            document.getElementById('Rating2').className = "Filled";
            document.getElementById('Rating3').className = "Filled";
            document.getElementById('Rating4').className = "Empty";
            document.getElementById('Rating5').className = "Empty";
        }
        if (option1 == 4) {
            document.getElementById('Rating1').className = "Filled";
            document.getElementById('Rating2').className = "Filled";
            document.getElementById('Rating3').className = "Filled";
            document.getElementById('Rating4').className = "Filled";
            document.getElementById('Rating5').className = "Empty";
        }
        if (option1 == 5) {
            document.getElementById('Rating1').className = "Filled";
            document.getElementById('Rating2').className = "Filled";
            document.getElementById('Rating3').className = "Filled";
            document.getElementById('Rating4').className = "Filled";
            document.getElementById('Rating5').className = "Filled";
        }
        return false;
    }

    function Decide(option) {
        if ($("#Rating1").attr("accesskey") != "") {
            var temp = "", set1, get1, SociRate;
            document.getElementById('lblRate').innerText = "";
            if (option == 1) {
                document.getElementById('Rating1').className = "Filled";
                document.getElementById('Rating2').className = "Empty";
                document.getElementById('Rating3').className = "Empty";
                document.getElementById('Rating4').className = "Empty";
                document.getElementById('Rating5').className = "Empty";
                temp = "Bạn đã chấm cho trường này 1 sao";
                set1 = document.getElementById('lblRate').innerHTML = temp;
                var $mark = $("#Rating1").attr("name");
                var $ID_again1 = $("#Rating1").attr("lang");
                var $dataString = 'socialRate=' + $mark + '&schoolID=' + $ID_again1;
                $.ajax({
                    url: $("#Rating1").attr("data-url"),
                    type: 'POST',
                    data: $dataString,
                    success: function (data1) {
                        if (data1 < 1.25) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Empty"); $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.25 && data1 < 1.75) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Half");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.75 && data1 < 2.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.25 && data1 < 2.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Half");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.75 && data1 < 3.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.25 && data1 < 3.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Half");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.75 && data1 < 4.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 4.25 && data1 < 4.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Half");
                        }
                        else if (data1 >= 4.75 && data1 <= 5) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2", "Filled").attr("class"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Filled"); $("#Rating5").attr("class", "Filled");
                        }
                        $(".vote_noti").html("<label id='noti_again' style='color: #2C2C2C;'></label>");
                        $("#noti_again").html("(Trung bình " + data1 + " điểm)")
                            .hide()
                            .fadeIn(1500);
                    }
                });
            }
            if (option == 2) {
                document.getElementById('Rating1').className = "Filled";
                document.getElementById('Rating2').className = "Filled";
                document.getElementById('Rating3').className = "Empty";
                document.getElementById('Rating4').className = "Empty";
                document.getElementById('Rating5').className = "Empty";
                temp = "Bạn đã chấm cho trường này 2 sao";
                set1 = document.getElementById('lblRate').innerHTML = temp;
                var $mark = $("#Rating2").attr("name");
                var $ID_again1 = $("#Rating1").attr("lang");
                var $dataString = 'socialRate=' + $mark + '&schoolID=' + $ID_again1;
                $.ajax({
                    url: $("#Rating1").attr("data-url"),
                    type: 'POST',
                    data: $dataString,
                    success: function (data1) {
                        if (data1 < 1.25) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Empty"); $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.25 && data1 < 1.75) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Half");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.75 && data1 < 2.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.25 && data1 < 2.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Half");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.75 && data1 < 3.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.25 && data1 < 3.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Half");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.75 && data1 < 4.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 4.25 && data1 < 4.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Half");
                        }
                        else if (data1 >= 4.75 && data1 <= 5) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2", "Filled").attr("class"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Filled"); $("#Rating5").attr("class", "Filled");
                        }
                        $(".vote_noti").html("<label id='noti_again' style='color: #2C2C2C;'></label>");
                        $("#noti_again").html("(Trung bình " + data1 + " điểm)")
                            .hide()
                            .fadeIn(1500);
                    }
                });
            }
            if (option == 3) {
                document.getElementById('Rating1').className = "Filled";
                document.getElementById('Rating2').className = "Filled";
                document.getElementById('Rating3').className = "Filled";
                document.getElementById('Rating4').className = "Empty";
                document.getElementById('Rating5').className = "Empty";
                temp = "Bạn đã chấm cho trường này 3 sao";
                set1 = document.getElementById('lblRate').innerHTML = temp;
                var $mark = $("#Rating3").attr("name");
                var $ID_again1 = $("#Rating1").attr("lang");
                var $dataString = 'socialRate=' + $mark + '&schoolID=' + $ID_again1;
                $.ajax({
                    url: $("#Rating1").attr("data-url"),
                    type: 'POST',
                    data: $dataString,
                    success: function (data1) {
                        if (data1 < 1.25) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Empty"); $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.25 && data1 < 1.75) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Half");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.75 && data1 < 2.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.25 && data1 < 2.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Half");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.75 && data1 < 3.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.25 && data1 < 3.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Half");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.75 && data1 < 4.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 4.25 && data1 < 4.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Half");
                        }
                        else if (data1 >= 4.75 && data1 <= 5) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2", "Filled").attr("class"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Filled"); $("#Rating5").attr("class", "Filled");
                        }
                        $(".vote_noti").html("<label id='noti_again' style='color: #2C2C2C;'></label>");
                        $("#noti_again").html("(Trung bình " + data1 + " điểm)")
                            .hide()
                            .fadeIn(1500);
                    }
                });
            }
            if (option == 4) {
                document.getElementById('Rating1').className = "Filled";
                document.getElementById('Rating2').className = "Filled";
                document.getElementById('Rating3').className = "Filled";
                document.getElementById('Rating4').className = "Filled";
                document.getElementById('Rating5').className = "Empty";
                temp = "Bạn đã chấm cho trường này 4 sao";
                set1 = document.getElementById('lblRate').innerHTML = temp;
                var $mark = $("#Rating4").attr("name");
                var $ID_again1 = $("#Rating1").attr("lang");
                var $dataString = 'socialRate=' + $mark + '&schoolID=' + $ID_again1;
                $.ajax({
                    url: $("#Rating1").attr("data-url"),
                    type: 'POST',
                    data: $dataString,
                    success: function (data1) {
                        if (data1 < 1.25) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Empty"); $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.25 && data1 < 1.75) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Half");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.75 && data1 < 2.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.25 && data1 < 2.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Half");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.75 && data1 < 3.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.25 && data1 < 3.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Half");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.75 && data1 < 4.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 4.25 && data1 < 4.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Half");
                        }
                        else if (data1 >= 4.75 && data1 <= 5) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2", "Filled").attr("class"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Filled"); $("#Rating5").attr("class", "Filled");
                        }
                        $(".vote_noti").html("<label id='noti_again' style='color: #2C2C2C;'></label>");
                        $("#noti_again").html("(Trung bình " + data1 + " điểm)")
                            .hide()
                            .fadeIn(1500);
                    }
                });
            }
            if (option == 5) {
                document.getElementById('Rating1').className = "Filled";
                document.getElementById('Rating2').className = "Filled";
                document.getElementById('Rating3').className = "Filled";
                document.getElementById('Rating4').className = "Filled";
                document.getElementById('Rating5').className = "Filled";
                temp = "Bạn đã chấm cho trường này 5 sao";
                set1 = document.getElementById('lblRate').innerHTML = temp;
                var $mark = $("#Rating5").attr("name");
                var $ID_again1 = $("#Rating1").attr("lang");
                var $dataString = 'socialRate=' + $mark + '&schoolID=' + $ID_again1;
                $.ajax({
                    url: $("#Rating1").attr("data-url"),
                    type: 'POST',
                    data: $dataString,
                    success: function (data1) {
                        if (data1 < 1.25) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Empty"); $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.25 && data1 < 1.75) {
                            $("#Rating1").attr("class", "Filled");
                            $("#Rating2").attr("class", "Half");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 1.75 && data1 < 2.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Empty"); $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.25 && data1 < 2.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled");
                            $("#Rating3").attr("class", "Half");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 2.75 && data1 < 3.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Empty"); $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.25 && data1 < 3.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Half");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 3.75 && data1 < 4.25) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Empty");
                        }
                        else if (data1 >= 4.25 && data1 < 4.75) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2").attr("class", "Filled"); $("#Rating3").attr("class", "Filled"); $("#Rating4").attr("class", "Filled");
                            $("#Rating5").attr("class", "Half");
                        }
                        else if (data1 >= 4.75 && data1 <= 5) {
                            $("#Rating1").attr("class", "Filled"); $("#Rating2", "Filled").attr("class"); $("#Rating3").attr("class", "Filled");
                            $("#Rating4").attr("class", "Filled"); $("#Rating5").attr("class", "Filled");
                        }
                        $(".vote_noti").html("<label id='noti_again' style='color: #2C2C2C;'></label>");
                        $("#noti_again").html("(Trung bình " + data1 + " điểm)")
                            .hide()
                            .fadeIn(1500);
                    }
                });
            }
            links.onmouseover = null;
            return true;
        } else {
            alert("Bạn cần đăng nhập để chấm điểm trường này.");
            return false;
        }
        return true;
    }
</script>
<div class="allhome" style="padding-top: 15px;">
    <body onload="initialize()">
    
        <!---BEGIN Detail Form--->
        @{
            int schoolid = getSchoolID;
            string host = Dns.GetHostName();
            IPHostEntry ip = Dns.GetHostEntry(host);
            string strClientIP = ip.AddressList[0].ToString();
            var m10 = (from rs in db.ReportSchools
                       where rs.SchoolID == schoolid && rs.AuthorIP == strClientIP
                       select rs.ReportSchoolID).ToArray();
        }
        <div class="content-main" style="width: 690px;float: right;">
             <div class="boxMod" >
            <div id="resultTitle" class="boxTxt1">Chi Tiết Trường Học</div>
                 <div id="list">
                     <h2>
                         @Html.DisplayFor(x => x.SchoolName)
                     </h2>
                     <div class="options_btn">
                         <input type="submit" id="submit_btn1" name="@Html.DisplayFor(x => x.SchoolID)" title="Báo cáo vi phạm trường này" accesskey="@m10.Count()" class="report_school_button" value="" data-url="@Url.Action("Report", "School")" lang="@User.Identity.Name" />
                         <input type="button" id="submit_btn2" name="@Html.DisplayFor(x => x.SchoolID)" class="favourite_button" title="Thêm vào danh sách ưa thích" data-url="@Url.Action("AddToFavourite", "School")" lang="@User.Identity.Name" />
                     </div>
                     <div id="schoolType" class="info">
                         <label class="detail_title">Loại hình</label> <label class="detail_des">@Html.DisplayFor(x => x.TypeName)</label>
                     </div>
                     <div id="schoolAddress" class="info">
                         <label class="detail_title">Địa chỉ</label> <label class="detail_des">@Html.DisplayFor(x => x.Address) - Quận @Html.DisplayFor(x => x.DistrictName) - TP. @Html.DisplayFor(x => x.CityName)</label>
                     </div>
                     <div id="schoolPhone" class="info">
                         <label class="detail_title">Số điện thoại</label> <label class="detail_des">@Html.DisplayFor(x => x.Phone)</label>
                     </div>
                     <div id="website" class="info">
                         <label class="detail_title">Website</label> <label class="detail_des">@Html.DisplayFor(x => x.Website)</label>
                     </div>
                     <div id="schoolEmail" class="info">
                         <label class="detail_title">Email</label> <label class="detail_des">@Html.DisplayFor(x => x.Email)</label>
                     </div>
                     <div id="principal" class="info">
                         <label class="detail_title">Ban Giám Hiệu</label> <label class="detail_des">@Html.DisplayFor(x => x.Principal)</label>
                     </div>
                     <div id="program" class="info">
                         <label class="detail_title">Chương trình giảng dạy</label> <label class="detail_des">@Html.DisplayFor(x => x.Program)</label>
                     </div>
                     <div id="area" class="info">
                         <label class="detail_title">Diện tích</label> <label class="detail_des">@Html.DisplayFor(x => x.Area) m2</label>
                     </div>
                     <div id="enrollmentTime" class="info">
                         <label class="detail_title">Thời gian tuyển sinh</label> <label class="detail_des">@Html.DisplayFor(x => x.EnrollmentTime)</label>
                     </div>
                     <div id="acceptAge" class="info">
                         <label class="detail_title">Độ tuổi tuyển sinh</label> <label class="detail_des">@Html.DisplayFor(x => x.AcceptAgeDescription)</label>
                     </div>
                     <div id="admision" class="info">
                    
                         <label class="detail_title">Thủ tục nhập học</label> <label class="detail_des">@correctAdmission</label>
                     </div>
                     <div id="establishYear" class="info">
                         <label class="detail_title">Năm thành lập</label> <label class="detail_des">@Html.DisplayFor(x => x.EstablishYear)</label>
                     </div>
                     <div id="numbeOfTeacher" class="info">
                         <label class="detail_title">Tổng số giáo viên</label> <label class="detail_des">@Html.DisplayFor(x => x.NumberOfTeacher) giáo viên</label>
                     </div>
                     <div id="numberOfChildren" class="info">
                         <label class="detail_title">Tổng số học sinh</label> <label class="detail_des">@Html.DisplayFor(x => x.NumberOfChildren) học sinh</label>
                     </div>
                     <div id="tuitionFee" class="info">
                         <label class="detail_title">Học phí</label> <label class="detail_des">@Html.DisplayFor(x => x.TuitionFee) 000 VNĐ</label>
                     </div>
                     <div id="serviceName" class="info">
                         <label class="detail_title">Dịch vụ</label>  
                         <label class="detail_des">@for (int j = listservice.Count; j >= 1; j--)
                                                   {
                                                       @viewService[j - 1].ServiceName
                                                       <br />
                                                   }</label>
                     </div>
                     <div id="description" class="info">
                         <label class="detail_title">Thông tin thêm</label> <label class="detail_des">@Html.DisplayFor(x => x.Description)</label>
                     </div>
                 </div>
                 <br class="spacer" />
        </div>
        </div>
        <!---BEGIN Map Form--->
       <div class="dashboard" style="width: 260px;">
    <div class="content-header">
        <div class="header-inner">
        <div id="map-box" style="margin-left: 5px;">
            <h2>Xem trên bản đồ</h2>
            <br class="spacer" />
            <input type="hidden" id="GoogleAPI" name="GoogleAPI" value="@Html.DisplayFor(x => x.GoogleAPI)" />
            <div id="map_canvas" style="width:238px; height:350px;"></div>
        </div>
        </div>
                 <br class="spacer" />
        </div>
        </div>

        <!---BEGIN Rating Form--->
        <div class="dashboard" style="width: 260px;">
    <div class="content-header">
        <div class="header-inner">
            <div id="Ratingbox" runat="server">
                <div><p class="boxTxt1"><span>Đánh Giá</span></p></div>
                <label id="system_title" >Đánh giá của hệ thống:</label><br />
                <div id="sys_star">
                    @if (@systemRate < 1.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate == 1.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Half" />
                        <input type="button" class="Empty"/>
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate > 1.5 && @systemRate < 2.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Empty"/>
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate == 2.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Half"/>
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate > 2.5 && @systemRate < 3.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                        <input type="button" class="Empty" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate == 3.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                        <input type="button" class="Half" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate > 3.5 && @systemRate < 4.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                        <input type="button" class="Filled" />
                        <input type="button" class="Empty"/>
                    }
                    else if (@systemRate == 4.5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                        <input type="button" class="Filled" />
                        <input type="button" class="Half"/>
                    }
                    else if (@systemRate > 4.5 && @systemRate <= 5)
                    { 
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                        <input type="button" class="Filled" />
                        <input type="button" class="Filled"/>
                    }
                </div>
                <label id="comm_title">Đánh giá của cộng đồng:</label><br />
                <div id="soc_star">
                    @if (star == 0)
                    {
                        <input type="button" class="Empty" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Empty" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Empty" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star < 1.25 && star != 0)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Empty" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Empty" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 1.25 && star < 1.75)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Half" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Empty" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 1.75 && star < 2.25)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Empty" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 2.25 && star < 2.75)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Half" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 2.75 && star < 3.25)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Filled" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Empty" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 3.25 && star < 3.75)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Filled" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Half" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 3.75 && star < 4.25)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Filled" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Filled" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Empty" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 4.25 && star < 4.75)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Filled" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Filled" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Half" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    else if (star >= 4.75)
                    {
                        <input type="button" class="Filled" id="Rating1" onmouseover="return MouseOver(1);" onclick="return Decide(1);" runat="server" data-url="@Url.Action("Rating", "School")" name="1" lang="@Html.DisplayFor(x => x.SchoolID)" accesskey="@User.Identity.Name" />
                        <input type="button" class="Filled" id="Rating2" onmouseover="return MouseOver(2);" onclick="return Decide(2);" runat="server" name="2" />
                        <input type="button" class="Filled" id="Rating3" onmouseover="return MouseOver(3);" onclick="return Decide(3);" runat="server" name="3" />
                        <input type="button" class="Filled" id="Rating4" onmouseover="return MouseOver(4);" onclick="return Decide(4);" runat="server" name="4" />
                        <input type="button" class="Filled" id="Rating5" onmouseover="return MouseOver(5);" onclick="return Decide(5);" runat="server" name="5"/>
                    }
                    <br />
                    @if (socialrate.Count == 0)
                    { 
                        <label class="vote_noti" style="color: #2C2C2C; margin-left:-35px;" >(Chưa có ai đánh giá trường này)</label>
                    }
                    else
                    {
                        <label class="vote_noti" style="color: #2C2C2C; margin-left:-35px;" >(@star điểm / @socialrate.Count lượt đánh giá)</label>
                    }
                </div>
                <label id="lblRate" runat="server" style="font-weight:bold; font-size:11px;" ></label><br />
                <br class="spacer" />
            </div>
            <br class="spacer" />
        </div>
                 <br class="spacer" />
        </div>
        </div>
        <!---BEGIN Comment Form--->
        <div class="content-main" style="width: 690px;float: right;">
            <div class="boxMod" >
                <div id="right_search">
                    <div id="comment_title" class="boxTxt1" >Tất Cả @comment.Count Bình Luận</div>
                    @if (User.Identity.Name == "")
                    {
                        <label>(Bạn cần đăng nhập để được bình luận)</label>
                    }
                    else
                    {
                        <form method="post" id="commentForm" name="commentForm" action="Detail"  >
                            <textarea rows="3" cols="50" name="Comment_Content" id="Comment_Content" placeholder="Viết bình luận"></textarea>
                            <input type="hidden" id="schoolID" name="schoolID" value="@Html.DisplayFor(x => x.SchoolID)"/>
                            <input type="submit" class="button" id="submit_btn" value="Bình luận" />
                        </form>
                    }
                    @if (comment.Count > 10)
                    {
                        for (int j = comment.Count; j >= (comment.Count - 9); j--)
                        {
                            <input type="hidden" id="CommentId" value="@viewComment[j - 1].CommentID" />
                            <div id="comment_info">
                                @if (User.Identity.Name == "")
                                {
                                    <div id="username" class="comment_cnt">@Html.ActionLink(@viewComment[j - 1].UserName, "", "User", new { id = @viewComment[j - 1].UserID })</div>
                                    <div id="comment_content" class="comment_cnt">@viewComment[j - 1].CommentContent</div>
                                    <div id="report_cmt" class="comment_cnt">
                                        <input type="button" id="report_sbt" class="@User.Identity.Name" title="Báo cáo bình luận này" data-url="@Url.Action("ReportComment", "School")" name="@Html.DisplayFor(x => x.SchoolID)" />
                                    </div>
                                    <div id="time" class="comment_cnt">Lúc @viewComment[j - 1].CreatedTime</div>
                                }
                                else
                                {
                                    <div id="username" class="comment_cnt">@Html.ActionLink(@viewComment[j - 1].UserName, "~/User/ViewUserProfile", new { id = @viewComment[j - 1].UserID })</div>
                                    <div id="comment_content" class="comment_cnt">@viewComment[j - 1].CommentContent</div>
                                    var role = db.UserRoles.Single(ur => ur.RoleName == "Admin");
                                    string name = User.Identity.Name;
                                    var user = from u in db.Users
                                               where (u.UserName == name)
                                               select u;
                                    int userid = user.First().UserID;
                                    if (userid != viewComment[j - 1].UserID)
                                    {
                                        int commentid = viewComment[j - 1].CommentID;
                                        var m11 = (from rc in db.ReportComments
                                                   where rc.CommentID == commentid && rc.AuthorIP == strClientIP
                                                   select rc.ReportCommentID).ToArray();
                                        <input type="hidden" id="timeOfReport" name="timeOfReport" value="@viewComment[j - 1].TimeOfReport" />
                                        <input type="hidden" id="commentID" name="commentID" value="@viewComment[j - 1].CommentID" />
                                        <div id="report_cmt" class="comment_cnt">
                                            <input type="button" id="report_sbt" class="@User.Identity.Name" title="Báo cáo bình luận này" accesskey="@m11.Count()" data-url="@Url.Action("ReportComment", "School")" name="@Html.DisplayFor(x => x.SchoolID)" />
                                        </div>
                                    }
                                    if (userid == viewComment[j - 1].UserID || user.First().RoleID == role.RoleID)
                                    {
                                        <div id="delete_cmt" class="comment_cnt">
                                            @Html.ActionLink("ｘ", "DeleteComment", new { commentID = viewComment[j - 1].CommentID }, new { @class = "delete-qa-button" })
                                            <script type="text/javascript">
                                                $(document).ready(function () {

                                                    $(".comment_cnt").editable("/School/EditComment",
                                                                                    {
                                                                                        type: 'textarea',
                                                                                        rows: 4,
                                                                                        columns: 10,
                                                                                        cancel: 'Cancel',
                                                                                        submit: 'OK',
                                                                                        submitdata: {
                                                                                            CommentId: function () {
                                                                                                return $("#CommentId").val();
                                                                                            },
                                                                                            RecordType: "COMMENT"
                                                                                        }
                                                                                    });
                                                });
                                                       </script> 
                                        </div>
                                    }
                                    <div id="time" class="comment_cnt">Lúc @viewComment[j - 1].CreatedTime</div>
                                }
                            </div>
                        }
                        <p class="seemore"><a href="">-Xem thêm-</a></p>
                    }
                    else
                    {
                        for (int j = comment.Count; j >= 1; j--)
                        {
                              <input type="hidden" id="CommentId" value="@viewComment[j - 1].CommentID" />
                            <div id="comment_info">
                                @if (User.Identity.Name == "")
                                {
                                    <div id="username" class="comment_cnt">@Html.ActionLink(@viewComment[j - 1].UserName, "~/User/ViewUserProfile", new { id = @viewComment[j - 1].UserID })</div>
                                    <div id="comment_content" class="comment_cnt">@viewComment[j - 1].CommentContent</div>
                                    <div id="report_cmt" class="comment_cnt">
                                        <input type="button" id="report_sbt" class="@User.Identity.Name" title="Báo cáo bình luận này" data-url="@Url.Action("ReportComment", "School")" name="@Html.DisplayFor(x => x.SchoolID)" />
                                    </div>
                                    <div id="time" class="comment_cnt">Lúc @viewComment[j - 1].CreatedTime</div>
                                }
                                else
                                {
                                    <div id="username" class="comment_cnt"><a href="@Url.Action("ViewUserProfile", "User", new { id = viewComment[j - 1].UserID })">@viewComment[j - 1].UserName</a></div>
                                    <div id="comment_content" class="comment_cnt">@viewComment[j - 1].CommentContent</div>
                                    var role = db.UserRoles.Single(ur => ur.RoleName == "Admin");
                                    string name = User.Identity.Name;
                                    var user = from u in db.Users
                                               where (u.UserName == name)
                                               select u;
                                    int userid = user.First().UserID;
                                    if (User.Identity.Name != @viewComment[j - 1].UserName)
                                    {
                                        int commentid = viewComment[j - 1].CommentID;
                                        var m11 = (from rc in db.ReportComments
                                                   where rc.CommentID == commentid && rc.AuthorIP == strClientIP
                                                   select rc.ReportCommentID).ToArray();
                                        <input type="hidden" id="timeOfReport" name="timeOfReport" value="@viewComment[j - 1].TimeOfReport" />
                                        <input type="hidden" id="commentID" name="commentID" value="@viewComment[j - 1].CommentID" />
                                        <div id="report_cmt" class="comment_cnt">
                                            <input type="button" id="report_sbt" class="@User.Identity.Name" title="Báo cáo bình luận này" accesskey="@m11.Count()" data-url="@Url.Action("ReportComment", "School")" name="@Html.DisplayFor(x => x.SchoolID)" />
                                        </div>
                                    }
                                    if (userid == viewComment[j - 1].UserID || user.First().RoleID == role.RoleID)
                                    {
                                        <div id="delete_cmt" class="comment_cnt">
                                             @Html.ActionLink("ｘ", "DeleteComment", new { commentID = viewComment[j - 1].CommentID }, new { @class = "delete-qa-button" })
                                             <script type="text/javascript">
                                                 $(document).ready(function () {

                                                     $(".comment_cnt").editable("/School/EditComment",
                                                                                    {
                                                                                        type: 'textarea',
                                                                                        rows: 4,
                                                                                        columns: 10,
                                                                                        cancel: 'Cancel',
                                                                                        submit: 'OK',
                                                                                        submitdata: {
                                                                                            CommentId: function () {
                                                                                                return $("#CommentId").val();
                                                                                            },
                                                                                            RecordType: "COMMENT"
                                                                                        }
                                                                                    });
                                                 });
                                                       </script> 
                                        </div>
                                    }
                                    <div id="time" class="comment_cnt">Lúc @viewComment[j - 1].CreatedTime</div>
                                }
                            </div>
                        }
                    }
                </div>
                <br class="spacer" />
            </div>
        </div>
  </body>
    <br class="spacer" />
</div>
<script type="text/javascript">
    $('#report_sbt').live('click', function () {
        if ($(this).attr("class") != "") {
            var $get101 = $(this).attr("accesskey");
            if ($get101 == 0) {
                var $report_cnt;
                $report_cnt = prompt("Xin hãy cho chúng tôi biết lí do: ");
                if ($report_cnt == "" || $report_cnt == null) {
                    alert("Bạn chưa nhập nội dung. Xin hãy thử lại!");
                    return false;
                } else {
                    var $ID_again = $(this).attr("name");
                    var $time_of_report = document.getElementById('timeOfReport').value;
                    var $comment_id = document.getElementById('commentID').value;
                    var $dataString = 'commentID=' + $comment_id + '&report_cnt=' + $report_cnt + '&schoolID=' + $ID_again;
                    $.ajax({
                        url: $(this).attr("data-url"),
                        type: 'POST',
                        data: $dataString,
                        success: function (data3) {
                            document.getElementById('report_sbt').setAttribute('accesskey', 1);
                            alert(data3);
                        }
                    });
                    return true;
                }
            } else {
                alert("Bạn đã báo cáo vi phạm cho nội dung này.");
                return false;
            }
            return true;
        } else {
            alert("Bạn cần đăng nhập để báo cáo cho nội dung này.");
            return false;
        }
        return true;
    });
</script>
@*<script type="text/javascript">
    $('#del_btn').live('click', function () {
        if (confirm("Bạn có chắc muốn xóa bình luận này?") == true) {
            var $commentid = $(this).attr("name");
            var $dataString = 'commentID=' + $commentid;
            $.ajax({
                url: $(this).attr("data-url"),
                type: 'POST',
                data: $dataString,
                success: function (data3) {
                    alert(data3);
                    $("#comment_info").fadeOut(500);
                }
            });
            return true;
        } else {
            return false;
        }
        return true;
    });
</script>*@